<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>


<isperp:grid url="task/search/list" gridId="taskSearchGrid"
	ondbClickRowEvent="taskSearchGrid.view(rowid);" editOrDeleteRightControl="true"
	cusDeleteUrl="task/task/delete"
	cusViewUrl="task/task/view" excelExportUrl="task/task/excelExport">

	<jsp:attribute name="toolbar">
	<isperp:toolbar id="userToolbar">
		

	</isperp:toolbar>
	</jsp:attribute>

	<jsp:attribute name="searchbar">
	<table class="search-table">
	<tbody>
		<tr>
			<td class="td1">编号：</td>
			<td class="td2"><input type="text" field="code" op="cn">
			</td>
			<td class="td1">名称：</td>
			<td class="td2"><input type="text" field="name" op="cn">
			</td>
			<td class="td1">发起人：</td>
			<td class="td2"><input type="text" field="creator,creator_name"
						op="cn" />
			</td>
			
		</tr>
		<tr>
			<td class="td1">优先级：</td>
			<td class="td2"><isperp:dictSelector id="priority" op="eq"
							field="priority" hasEmptyValue="true" typeCode="TASK_PRIORITY"></isperp:dictSelector>							
							
			</td>
			<td class="td1">是否延期：</td>
			<td class="td2"><input type="radio" field="is_delay" op="in"
						name="group1" value="'是','否'" checked />全部 <input type="radio"
						field="is_delay" op="eq" name="group1" value="是" />是<input
						type="radio" field="is_delay" op="eq" name="group1" value="否" />否
			</td>
			<td class="td1">任务状态：</td>
			<td class="td2"><isperp:dictSelector id="status" op="eq"
							field="status" hasEmptyValue="true" typeCode="TASK_STATUS"></isperp:dictSelector>						
							
			</td>
		</tr>
		
		<tr>
			
			<td class="td1">计划处理人：</td>
			<td class="td2"><input type="text"
						field="plan_principal_id,plan_principal_name" op="cn" />
			</td>
			<td class="td1">实际处理人：</td>
			<td class="td2" colspan="3"><input type="text"
						field="act_principal_id,act_principal_name" op="cn" />
			</td>
		</tr>
		<tr>
			<td class="td1">计划开始日期：</td>
			<td class="td2"><input id="planStartDateStart" type="date"
						field="plan_start_time" op="gt" style="width: 68px" />~<input
						id="planStartDateEnd" type="date" field="plan_start_time" op="lt"
						style="width: 68px" />
			</td>
			<td class="td1">计划结束日期：</td>
			<td class="td2" colspan="3"><input id="planEndDateStart"
						type="date" field="plan_end_time" op="gt" style="width: 68px" />~<input
						id="planEndDateEnd" name="plan_end_time" type="date"
						field="plan_end_time" op="lt" style="width: 68px" />
			</td>
			
		</tr>
		<c:if test="${dataRange!=22 && dataRange!=33 }">
		<tr>
		  <td class="td1">所属项目：</td>
			<td class="td2" colspan="5"><form:select path="projects"
								field="project_id" op="cn" data-allow-empty="true"
								items="${projects}" itemLabel="name" itemValue="id"
								cssClass="search" />
			</td>
		</tr>
		</c:if>
	</tbody>
	</table>
	</jsp:attribute>
	<jsp:body>
	<isperp:column name="id" title="id" hidden="true">
	<isperp:column name="priority" title="" width="28"
				isFormatterFun="true"
				formatter="return statusFormatter(cellvalue,rowObject.id,2);">
	</isperp:column>
	</isperp:column>
		<isperp:column name="is_delay" title="" width="28"
			isFormatterFun="true"
			formatter="return statusFormatter(cellvalue,rowObject.id,1);">
	</isperp:column>
	<isperp:column name="code" title="编号" width="100">
	</isperp:column>
	<isperp:column name="name" title="名称" width="120">
	</isperp:column>
	<isperp:column name="creator_name" title="发起人" width="120">
	</isperp:column>
	<isperp:column name="plan_start_time" title="计划开始时间" width="140">
	</isperp:column>
	<isperp:column name="plan_end_time" title="计划结束时间" width="140">
		
	</isperp:column>
		<isperp:column name="plan_principal_name" title="负责人" width="80">
	</isperp:column>
	<isperp:column name="status" title="状态" width="60">
	</isperp:column>
	</jsp:body>

</isperp:grid>

<isperp:operate code="TSK_SEARCH"></isperp:operate>

<script type="text/javascript">
	function statusFormatter(cellvalue, rowid, type) {
		if (type == 1) {
			if (cellvalue == '是')
				return "<img title='任务延期' src='img/incident/sla_unusual.png'>";
			else
				return "";
		} else if (type == 2) {
			if (cellvalue == '一级')
				return "<img title='优先级：1级' src='img/incident/p1.png'>";
			else if (cellvalue == '二级')
				return "<img title='优先级：2级' src='img/incident/p2.png'>";
			else if (cellvalue == '三级')
				return "<img title='优先级：3级' src='img/incident/p3.png'>";
			else if (cellvalue == '四级')
				return "<img title='优先级：4级' src='img/incident/p4.png'>";
			else
				return "<img title='优先级：5级' src='img/incident/p5.png'>";
		}

	}
</script>